﻿using League.UserControls;
using Microsoft.Windows.Controls.Ribbon;
using System;
using System.Windows;


namespace League
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : RibbonWindow
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        // Window Evenets

        private void RibbonWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            string messageBoxText = "Do you want to quit Talqum League? Unsaved changes will be lost.";
            string caption = "Are you sure?";

            MessageBoxButton button = MessageBoxButton.YesNo;
            MessageBoxImage icon = MessageBoxImage.Warning;

            // Display message box
            MessageBoxResult result = MessageBox.Show(messageBoxText, caption, button, icon);

            // Process message box results 
            switch (result)
            {
                case MessageBoxResult.No:
                    // User pressed Yes button 
                    e.Cancel = true;
                    break;
            }
        }

        // Button Evenets

        private void RibbonApplicationMenuItem_About(object sender, System.Windows.RoutedEventArgs e)
        {
            // Instantiate window
            AboutWindow aboutWindow = new AboutWindow();
            aboutWindow.Owner = this;

            // Show window modally
            // NOTE: Returns only when window is closed
            Nullable<bool> dialogResult = aboutWindow.ShowDialog();
        }

        private void RibbonApplicationMenuItem_Exit(object sender, System.Windows.RoutedEventArgs e)
        {
             this.Close(); 
        }



        private void RibbonApplicationMenuItem_Preferences(object sender, RoutedEventArgs e)
        {
            // Instantiate window
            PreferencesWindow prefWindow = new PreferencesWindow();
            prefWindow.Owner = this;

            // Show window modally
            // NOTE: Returns only when window is closed
            Nullable<bool> dialogResult = prefWindow.ShowDialog();
        }
    }
}
